//
//  PersonalCollectionViewCell.m
//  TeamInformatization
//
//  Created by bigger on 2019/3/31.
//  Copyright © 2019年 SPIC. All rights reserved.
//

#import "PersonalCollectionViewCell.h"

@interface PersonalCollectionViewCell ()

@property (nonatomic, strong) UIImageView *showImageView;
@property (nonatomic, strong) SimpleLabel *typeTitleLabel;

@end


@implementation PersonalCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = kCommonBGGaryColor;
        [self creatCellView];
    }
    
    return self;
}

- (void)creatCellView
{
    UIView *bgView = [[UIView alloc] init];
    bgView.backgroundColor = [UIColor whiteColor];
    [self addSubview:bgView];
    [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.mas_equalTo(5 * kScaleWidth);
        make.right.bottom.mas_equalTo(-5 * kScaleWidth);
    }];
    bgView.layer.masksToBounds = YES;
    bgView.layer.cornerRadius = 10.;
    bgView.layer.shouldRasterize = YES; //圆角缓存
    bgView.layer.rasterizationScale = [UIScreen mainScreen].scale;// 抗锯齿边缘
    
    self.showImageView = [[UIImageView alloc] init];
    [bgView addSubview:_showImageView];
    [_showImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(26 * kScaleWidth);
        make.centerX.mas_equalTo(self);
        make.size.mas_equalTo(CGSizeMake(40 * kScaleWidth, 40 * kScaleWidth));
    }];
    
    self.typeTitleLabel = [SimpleLabel initWithText:@"" TextColor:kSetRGBColor(117, 117, 117, 1) TextFont:[UIFont systemFontOfSize:14] TextAlignment:NSTextAlignmentCenter];
    [bgView addSubview:_typeTitleLabel];
    [_typeTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.showImageView.mas_bottom).offset(10 * kScaleWidth);
        make.centerX.equalTo(self);
    }];
    
}

- (void)setShowViewCellWithTypeTitle:(NSString *)title ImageStr:(NSString *)imageStr
{
    _showImageView.image = [UIImage imageNamed:imageStr];
    
    _typeTitleLabel.text = title;
    
}


@end
